package com.fengye.algorithms.huawei;

import java.util.Scanner;

/**
 * @Author fengye
 * @Date 2023/4/7 11:05
 **/
public class Select7Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int count = n / 7;
            for (int i = 1; i <= n; i++) {
                String si = i + "";
                if (si.contains("7") && i % 7 != 0) {
                    count++;
                }
            }

            System.out.println(count);
        }
    }
}
